#ifndef SDK_OHOS_OHOS_VIDEO_RENDER_ADAPTER_H_
#define SDK_OHOS_OHOS_VIDEO_RENDER_ADAPTER_H_

#include "rtc_base/logging.h"
#include "api/video/video_frame.h"
#include "api/video/video_sink_interface.h"
#include "api/ohos_video_render_interface.h"

namespace ohoswebrtc {

/** Add ohos render impl to receive onFrame call */
class OHOSVideoRenderAdapter : public rtc::VideoSinkInterface<webrtc::VideoFrame>,
                               public webrtc::RefCountInterface {
  public:
    /** Initialize an OHOSVideoRenderAdapter with an OHOSVideoRenderInterface. */
    OHOSVideoRenderAdapter(rtc::scoped_refptr<OHOSVideoRenderInterface> renderer);
    /** native render */
    rtc::scoped_refptr<OHOSVideoRenderInterface> get_render() {
      return renderer_;
    }

  protected:
    /** render frame method*/
    void OnFrame(const webrtc::VideoFrame& frame) override;
    virtual ~OHOSVideoRenderAdapter();

  private:
    rtc::scoped_refptr<OHOSVideoRenderInterface> renderer_;
};

}

#endif